<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:choose>
	<c:when test="${q5 != nul}">
		<p>${fn:escapeXml("#{ #{ db.((Rank as r) where not(count(r.customers.deals.cost) > ")}${q5Cost}</p>

		<form class="form-horizontal">
			<div class="control-group">
				<label class="control-label" for="q5Cost" style="margin-right: 5px;">Deal cost </label>
				<div class="input-append">
					<input type="text" id="q5Cost" placeholder="q5Cost" name="q5Cost" value="${q5Cost}">
					<input type="hidden" name="activeTab" value="q5" />
					<button class="btn" type="submit">Search!</button>
				</div>
			</div>
		</form>

		<table class="table table-hover">
			<thead>
				<tr>
					<th>Nazwa</th>
					<th>Koszt</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="rank" items="${q5}">
					<tr>
						<td>
							<c:out value="${rank.groupName}"/>
						</td>
						<td>
							<c:forEach var="entry" items="${q5a}">
								<c:if test="${entry.key == rank.groupName}">
									<b><c:out value="${entry.value}"/></b>
								</c:if>
								</c:forEach>
							<c:out value="${q5a['rank.groupName']}" />
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:when>
	<c:otherwise>
		<p>Sorry no data found ;(</p>
	</c:otherwise>
</c:choose>
